﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category9
{
  public class MT942 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagDefinition U0004;
    private static SwiftTagSubItemDefinition U0005;
    private static SwiftTagDefinition U0006;
    private static SwiftTagSubItemDefinition U0007;
    private static SwiftTagDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;
    private static SwiftTagSubItemDefinition U000F;
    private static SwiftTagSubItemDefinition U0010;
    private static SwiftTagDefinition U0011;
    private static SwiftTagSubItemDefinition U0012;
    private static SwiftTagSubItemDefinition U0013;
    private static SwiftTagDefinition U0014;
    private static SwiftTagSubItemDefinition U0015;
    private static SwiftTagSubItemDefinition U0016;
    private static SwiftTagDefinition U0017;
    private static SwiftTagSubItemDefinition U0018;
    private static SwiftTagSubItemDefinition U0019;
    private static SwiftTagSubItemDefinition U001A;
    private static SwiftTagSubItemDefinition U001B;
    private static SwiftTagSequenceDefinition U001C;
    private static SwiftTagDefinition U001D;
    private static SwiftTagSubItemDefinition U001E;
    private static SwiftTagSubItemDefinition U001F;
    private static SwiftTagDefinition U007F;
    private static SwiftTagDefinition U0080;
    private static SwiftTagSubItemDefinition U0081;
    private static SwiftTagDefinition U0082;
    private static SwiftTagSubItemDefinition U0083;
    private static SwiftTagDefinition U0084;

    [Description("Transaction Reference Number ")]
    public Tag20 TransactionReferenceNumber_20
    {
      get
      {
        return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0002);
      }
    }

    [Description("Transaction Reference Number ")]
    public Tag20 Tag20_TransactionReferenceNumber
    {
      get
      {
        return this.TransactionReferenceNumber_20;
      }
    }

    [Description("Related Reference ")]
    public Tag21 RelatedReference_21
    {
      get
      {
        return new Tag21((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0004);
      }
    }

    [Description("Related Reference ")]
    public Tag21 Tag21_RelatedReference
    {
      get
      {
        return this.RelatedReference_21;
      }
    }

    [Description("Account Identification ")]
    public Tag25 AccountIdentification_25
    {
      get
      {
        return new Tag25((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0006);
      }
    }

    [Description("Account Identification ")]
    public Tag25 Tag25_AccountIdentification
    {
      get
      {
        return this.AccountIdentification_25;
      }
    }

    [Description("Statement Number/ Sequence Number ")]
    public Tag28C StatementNumberSequenceNumber_28C
    {
      get
      {
        return new Tag28C((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0008);
      }
    }

    [Description("Statement Number/ Sequence Number ")]
    public Tag28C Tag28C_StatementNumberSequenceNumber
    {
      get
      {
        return this.StatementNumberSequenceNumber_28C;
      }
    }

    [Description("Floor Limit Indicator ")]
    public Tag34F FloorLimitIndicator_34F
    {
      get
      {
        return new Tag34F((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0011);
      }
    }

    [Description("Floor Limit Indicator ")]
    public Tag34F Tag34F_FloorLimitIndicator
    {
      get
      {
        return this.FloorLimitIndicator_34F;
      }
    }

    [Description("Field Limit Indicator")]
    public Tag34F FloorLimitIndicator_1_34F
    {
      get
      {
        return new Tag34F((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0014);
      }
    }

    [Description("Field Limit Indicator")]
    public Tag34F Tag34F_FloorLimitIndicator_1
    {
      get
      {
        return this.FloorLimitIndicator_1_34F;
      }
    }

    [Description("Date Time Indication")]
    public Tag13D DateTimeIndication_13D
    {
      get
      {
        return new Tag13D((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0017);
      }
    }

    [Description("Date Time Indication")]
    public Tag13D Tag13D_DateTimeIndication
    {
      get
      {
        return this.DateTimeIndication_13D;
      }
    }

    [Description("Statement Line")]
    public MT942.SequenceClass[] Sequence
    {
      get
      {
        int index = -1;
        List<MT942.SequenceClass> list = new List<MT942.SequenceClass>();
        int count;
        do
        {
          ++index;
          MT942.SequenceClass sequenceClass = new MT942.SequenceClass((SwiftElement) this, index, false);
          count = this.ListTags((SwiftElement) sequenceClass).Count;
          if (count > 0)
            list.Add(sequenceClass);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Number and Sum of Entries ")]
    public Tag90D NumberAndSumOfEntries_90D
    {
      get
      {
        return new Tag90D((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0080);
      }
    }

    [Description("Number and Sum of Entries ")]
    public Tag90D Tag90D_NumberAndSumOfEntries
    {
      get
      {
        return this.NumberAndSumOfEntries_90D;
      }
    }

    [Description("Number and Sum of Entries")]
    public Tag90C NumberAndSumOfEntries_90C
    {
      get
      {
        return new Tag90C((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0082);
      }
    }

    [Description("Number and Sum of Entries")]
    public Tag90C Tag90C_NumberAndSumOfEntries
    {
      get
      {
        return this.NumberAndSumOfEntries_90C;
      }
    }

    [Description("Information To Account Owner")]
    public Tag86 InformationToAccountOwner_1_86
    {
      get
      {
        return new Tag86((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U0084);
      }
    }

    [Description("Information To Account Owner")]
    public Tag86 Tag86_InformationToAccountOwner_1
    {
      get
      {
        return this.InformationToAccountOwner_1_86;
      }
    }

    public MT942()
      : base(true)
    {
    }

    public MT942(SwiftMessage message)
      : base(message)
    {
    }

    public MT942.SequenceClass AddSequence()
    {
      return new MT942.SequenceClass((SwiftElement) this, this.Sequence.Length, true);
    }

    public void RemoveSequence(MT942.SequenceClass sequence)
    {
      foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
        this.RemoveTag(tag);
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT942.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT942.MessageDefinition = new SwiftMessageDefinition("MT942", "Interim Transaction Report");
      MT942.U0002 = new SwiftTagDefinition("TransactionReferenceNumber_20", "Transaction Reference Number ");
      MT942.U0002.TagName = ":20:";
      MT942.U0003 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT942.U0002.Elements.Add((SwiftDefinitionElement) MT942.U0003);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0002);
      MT942.U0004 = new SwiftTagDefinition("RelatedReference_21", "Related Reference ");
      MT942.U0004.TagName = ":21:";
      MT942.U0004.Mandatory = false;
      MT942.U0005 = new SwiftTagSubItemDefinition("Reference", " Reference");
      MT942.U0004.Elements.Add((SwiftDefinitionElement) MT942.U0005);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0004);
      MT942.U0006 = new SwiftTagDefinition("AccountIdentification_25", "Account Identification ");
      MT942.U0006.TagName = ":25:";
      MT942.U0007 = new SwiftTagSubItemDefinition("Account", "Account");
      MT942.U0006.Elements.Add((SwiftDefinitionElement) MT942.U0007);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0006);
      MT942.U0008 = new SwiftTagDefinition("StatementNumberSequenceNumber_28C", "Statement Number/ Sequence Number ");
      MT942.U0008.TagName = ":28C:";
      MT942.U000E = new SwiftTagSubItemDefinition("StatementNumber", "Statement Number");
      MT942.U0008.Elements.Add((SwiftDefinitionElement) MT942.U000E);
      MT942.U000F = new SwiftTagSubItemDefinition("StatementNumberSequenceNumber", "");
      MT942.U000F.Mandatory = false;
      MT942.U0010 = new SwiftTagSubItemDefinition("SequenceNumber", "Sequence Number");
      MT942.U000F.Elements.Add((SwiftDefinitionElement) MT942.U0010);
      MT942.U0008.Elements.Add((SwiftDefinitionElement) MT942.U000F);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0008);
      MT942.U0011 = new SwiftTagDefinition("FloorLimitIndicator_34F", "Floor Limit Indicator ");
      MT942.U0011.TagName = ":34F:";
      MT942.U0012 = new SwiftTagSubItemDefinition("Currency", "Currency");
      MT942.U0011.Elements.Add((SwiftDefinitionElement) MT942.U0012);
      MT942.U0013 = new SwiftTagSubItemDefinition("DCMarkAndAmount", "Amount");
      MT942.U0011.Elements.Add((SwiftDefinitionElement) MT942.U0013);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0011);
      MT942.U0014 = new SwiftTagDefinition("FloorLimitIndicator_1_34F", "Field Limit Indicator");
      MT942.U0014.TagName = ":34F:";
      MT942.U0014.Mandatory = false;
      MT942.U0015 = new SwiftTagSubItemDefinition("Currency", "Currency");
      MT942.U0014.Elements.Add((SwiftDefinitionElement) MT942.U0015);
      MT942.U0016 = new SwiftTagSubItemDefinition("DCMarkAndAmount", "Amount");
      MT942.U0014.Elements.Add((SwiftDefinitionElement) MT942.U0016);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0014);
      MT942.U0017 = new SwiftTagDefinition("DateTimeIndication_13D", "Date Time Indication");
      MT942.U0017.TagName = ":13D:";
      MT942.U0018 = new SwiftTagSubItemDefinition("Date", "Date");
      MT942.U0017.Elements.Add((SwiftDefinitionElement) MT942.U0018);
      MT942.U0019 = new SwiftTagSubItemDefinition("Time", "Time");
      MT942.U0017.Elements.Add((SwiftDefinitionElement) MT942.U0019);
      MT942.U001A = new SwiftTagSubItemDefinition("Sign", "Sign");
      MT942.U0017.Elements.Add((SwiftDefinitionElement) MT942.U001A);
      MT942.U001B = new SwiftTagSubItemDefinition("Offset", "Offset");
      MT942.U0017.Elements.Add((SwiftDefinitionElement) MT942.U001B);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0017);
      MT942.U001C = new SwiftTagSequenceDefinition("Sequence", "Statement Line");
      MT942.U001C.Mandatory = false;
      MT942.U001C.Multiple = true;
      MT942.U001D = new SwiftTagDefinition("StatementLine_61", "Statement Line");
      MT942.U001D.TagName = ":61:";
      MT942.U001D.Mandatory = false;
      MT942.U001D.Multiple = true;
      MT942.U001E = new SwiftTagSubItemDefinition("StatementLine1", "Value Date, Entry Date, Debit Credit Mark, Funds Code, Amount, Transaction Type Identification Code, Reference For The Account Owner, Account Servicing Institutions Reference");
      MT942.U001D.Elements.Add((SwiftDefinitionElement) MT942.U001E);
      MT942.U001F = new SwiftTagSubItemDefinition("SupplementaryDetails", "Supplementary Details");
      MT942.U001F.Mandatory = false;
      MT942.U001D.Elements.Add((SwiftDefinitionElement) MT942.U001F);
      MT942.U001C.Elements.Add((SwiftDefinitionElement) MT942.U001D);
      MT942.U007F = new SwiftTagDefinition("InformationToAccountOwner_86", "Information To Account Owner");
      MT942.U007F.TagName = ":86:";
      MT942.U007F.Mandatory = false;
      MT942.U001C.Elements.Add((SwiftDefinitionElement) MT942.U007F);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U001C);
      MT942.U0080 = new SwiftTagDefinition("NumberAndSumOfEntries_90D", "Number and Sum of Entries ");
      MT942.U0080.TagName = ":90D:";
      MT942.U0080.Mandatory = false;
      MT942.U0081 = new SwiftTagSubItemDefinition("NumberCurrencyAndAmount", "Number ,Currency And Amount");
      MT942.U0080.Elements.Add((SwiftDefinitionElement) MT942.U0081);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0080);
      MT942.U0082 = new SwiftTagDefinition("NumberAndSumOfEntries_90C", "Number and Sum of Entries");
      MT942.U0082.TagName = ":90C:";
      MT942.U0082.Mandatory = false;
      MT942.U0083 = new SwiftTagSubItemDefinition("NumberCurrencyAndAmount", "Number ,Currency and Amount");
      MT942.U0082.Elements.Add((SwiftDefinitionElement) MT942.U0083);
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0082);
      MT942.U0084 = new SwiftTagDefinition("InformationToAccountOwner_1_86", "Information To Account Owner");
      MT942.U0084.TagName = ":86:";
      MT942.U0084.Mandatory = false;
      MT942.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT942.U0084);
    }

    public class SequenceClass : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT942.U001C;
        }
      }

      [Description("Statement Line")]
      public MT942.SequenceClass.Tag61[] StatementLine_61
      {
        get
        {
          int index = -1;
          List<MT942.SequenceClass.Tag61> list = new List<MT942.SequenceClass.Tag61>();
          int count;
          do
          {
            ++index;
            MT942.SequenceClass.Tag61 tag61 = new MT942.SequenceClass.Tag61((SwiftElement) this, index, (SwiftDefinitionElement) MT942.U001D);
            count = this.ListTags((SwiftElement) tag61).Count;
            if (count > 0)
              list.Add(tag61);
          }
          while (count > 0);
          return list.ToArray();
        }
      }

      [Description("Statement Line")]
      public MT942.SequenceClass.Tag61[] Tag61_StatementLine
      {
        get
        {
          return this.StatementLine_61;
        }
      }

      [Description("Information To Account Owner")]
      public Tag86 InformationToAccountOwner_86
      {
        get
        {
          return new Tag86((SwiftElement) this, 0, (SwiftDefinitionElement) MT942.U007F);
        }
      }

      [Description("Information To Account Owner")]
      public Tag86 Tag86_InformationToAccountOwner
      {
        get
        {
          return this.InformationToAccountOwner_86;
        }
      }

      internal SequenceClass(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }

      public MT942.SequenceClass.Tag61 AddStatementLine_61()
      {
        return new MT942.SequenceClass.Tag61((SwiftElement) this, this.StatementLine_61.Length, (SwiftDefinitionElement) MT942.U001D)
        {
          Value = string.Empty
        };
      }

      public void RemoveStatementLine_61(MT942.SequenceClass.Tag61 tag)
      {
        this.RemoveTag(tag.GetTag());
      }

      public class Tag61 : SwiftTagWrapper
      {
        public string Value
        {
          get
          {
            return this.GetValue();
          }
          set
          {
            this.SetValue("61", value);
          }
        }

        internal Tag61(SwiftElement parent, int index, SwiftDefinitionElement definition)
          : base(parent, index, definition)
        {
        }
      }
    }
  }
}
